package com.example.qiaoruian.shequ;

import android.text.InputType;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.example.qiaoruian.shequ.view.MyTitle;

/**
 * Created by qiaoruian on 2017/5/10.
 */

public class LoginActivity extends BaseActivity {

    private MyTitle mTitle;
    private LinearLayout mLinear;
    private LinearLayout mLinearZhuce;
    private FrameLayout mFrame_eyes;
    private ImageView mIv_eyeclosed;
    private ImageView mIv_eyeopend;
    private EditText mEt_password;

    @Override
    public void setView() {
            setContentView(R.layout.login_main);
    }

    @Override
    public void initView() {
        mTitle = (MyTitle)findViewById(R.id.title);
        mLinear = (LinearLayout)findViewById(R.id.Ll_ll);
        mLinearZhuce = (LinearLayout)findViewById(R.id.LL_zhuce);
        mFrame_eyes = (FrameLayout)findViewById(R.id.frame_eyes);
        mIv_eyeclosed = (ImageView)findViewById(R.id.imageView1);
        mIv_eyeopend = (ImageView)findViewById(R.id.imageView2);
        mEt_password = (EditText)findViewById(R.id.login_et_password);

        mTitle.getTv_title().setText("登录");
        mTitle.getIv_item().setVisibility(View.GONE);
        mTitle.getIv_item2().setVisibility(View.VISIBLE);
        mTitle.getTv_item1().setVisibility(View.VISIBLE);
        mTitle.getTv_item1().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mLinear.setVisibility(View.GONE);
                mLinearZhuce.setVisibility(View.VISIBLE);
                mTitle.getTv_item1().setVisibility(View.GONE);
                mTitle.getTv_title().setText("注册");
            }
        });
        mFrame_eyes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mIv_eyeopend.getVisibility()==View.VISIBLE){
                    mEt_password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

                    mIv_eyeopend.setVisibility(View.INVISIBLE);
                } else {
                    mEt_password.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
                    mIv_eyeopend.setVisibility(View.VISIBLE);
                }
            }
        });
    }

    @Override
    public void setListener() {

    }
}
